package com.zhang.struts.actions;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;

import com.zhang.struts.domain.OrderForm;
import com.zhang.web.services.ShopsDAO;

public class ShopAction extends DispatchAction {
	private ShopsDAO shopsDAO;

	public void setShopsDAO(ShopsDAO shopsDAO) {
		this.shopsDAO = shopsDAO;
	}

	public ActionForward shopsQuery(ActionMapping mapping,
            ActionForm form,
            HttpServletRequest request,
            HttpServletResponse response)
            		throws Exception {
			HttpSession session = request.getSession();			
			List list = shopsDAO.AllShops();
			if(list!=null){
				request.getSession().setAttribute("shopsList",list);
				return mapping.findForward("success");
			}
			else
				return mapping.findForward("failure");
			
	}	
	
}
